<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
    <style>
        .one {
            width: 100px;
            height: 200px;

        }

        .two {
            border: 1px solid green;
            width: 200px;
        }

        .test {
            width: 10px;
            height: 10px;
            background-color: red;
        }

        .test1 {
            width: 50px;
            height: 50px;
            background-color: yellow;
        }
    </style>
</head>

<body>
    <div id="contain">
        <div class="one" :class="two" @click="changstyle">测试</div>
        <!-- 动态绑定样式 -->
        <div class="test" :style="test1">hh</div>
    </div>

    <script>
        const vm = new Vue({
            el: '#contain',
            data: {
                two: '',
                width: '50px',
                test1: {
                    height: '50px',
                    backgroundColor: 'yellow',
                    fontSize: '10px'
                }

            }, methods: {
                changstyle() {
                    this.two = 'two'
                }
            },
        });
    </script>
</body>

</html>